home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / STDLIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  4.6 KB  |  155 lines

  1. /***
  2. *stdlib.h - declarations/definitions for commonly used library functions
  3. *
  4. *    Copyright (c) 1985-1989, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    This include file contains the function declarations for
  8. *    commonly used library functions which either don't fit somewhere
  9. *    else, or, like toupper/tolower, can't be declared in the normal
  10. *    place (ctype.h in the case of toupper/tolower) for other reasons.
  11. *    [ANSI]
  12. *
  13. ****/
  14.  
  15.  
  16. #ifndef _SIZE_T_DEFINED
  17. typedef unsigned int size_t;
  18. #define _SIZE_T_DEFINED
  19. #endif
  20.  
  21. #ifndef NO_EXT_KEYS    /* extensions enabled */
  22.     #define _CDECL    cdecl
  23.     #define _NEAR    near
  24. #else /* extensions not enabled */
  25.     #define _CDECL
  26.     #define _NEAR
  27. #endif /* NO_EXT_KEYS */
  28.  
  29.  
  30. /* definition of the return type for the onexit() function */
  31.  
  32. #define EXIT_SUCCESS    0
  33. #define EXIT_FAILURE    1
  34.  
  35. #ifndef _ONEXIT_T_DEFINED
  36. typedef int (_CDECL * _CDECL onexit_t)();
  37. #define _ONEXIT_T_DEFINED
  38. #endif
  39.  
  40.  
  41. /* Data structure definitions for div and ldiv runtimes. */
  42.  
  43. #ifndef    _DIV_T_DEFINED
  44.  
  45. typedef struct {
  46.     int quot;
  47.     int rem;
  48. } div_t;
  49.  
  50. typedef struct {
  51.     long quot;
  52.     long rem;
  53. } ldiv_t;
  54.  
  55. #define _DIV_T_DEFINED
  56. #endif
  57.  
  58. /* Maximum value that can be returned by the rand function. */
  59.  
  60. #define RAND_MAX 0x7fff
  61.  
  62.  
  63. /* min and max macros */
  64.  
  65. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  66. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  67.  
  68.  
  69. /* sizes for buffers used by the _makepath() and _splitpath() functions.
  70.  * note that the sizes include space for 0-terminator
  71.  */
  72.  
  73. #define _MAX_PATH    144        /* max. length of full pathname */
  74. #define _MAX_DRIVE    3        /* max. length of drive component */
  75. #define _MAX_DIR    130        /* max. length of path component */
  76. #define _MAX_FNAME    9        /* max. length of file name component */
  77. #define _MAX_EXT    5        /* max. length of extension component */
  78.  
  79. /* external variable declarations */
  80.  
  81. extern int _NEAR _CDECL errno;            /* XENIX style error number */
  82. extern int _NEAR _CDECL _doserrno;        /* MS-DOS system error value */
  83. extern char * _NEAR _CDECL sys_errlist[];    /* perror error message table */
  84. extern int _NEAR _CDECL sys_nerr;        /* # of entries in sys_errlist table */
  85.  
  86. extern char ** _NEAR _CDECL environ;        /* pointer to environment table */
  87.  
  88. extern unsigned int _NEAR _CDECL _psp;        /* Program Segment Prefix */
  89.  
  90. extern int _NEAR _CDECL _fmode;         /* default file translation mode */
  91.  
  92. /* DOS major/minor version numbers */
  93.  
  94. extern unsigned char _NEAR _CDECL _osmajor;
  95. extern unsigned char _NEAR _CDECL _osminor;
  96.  
  97. #define DOS_MODE    0    /* Real Address Mode */
  98. #define OS2_MODE    1    /* Protected Address Mode */
  99.  
  100. extern unsigned char _NEAR _CDECL _osmode;
  101.  
  102.  
  103. /* function prototypes */
  104.  
  105. double _CDECL atof(const char *);
  106. double _CDECL strtod(const char *, char * *);
  107. ldiv_t _CDECL ldiv(long, long);
  108.  
  109. void   _CDECL abort(void);
  110. int    _CDECL abs(int);
  111. int    _CDECL atexit(void (_CDECL *)(void));
  112. int    _CDECL atoi(const char *);
  113. long   _CDECL atol(const char *);
  114. void * _CDECL bsearch(const void *, const void *, size_t, size_t, int (_CDECL *)(const void *, const void *));
  115. void * _CDECL calloc(size_t, size_t);
  116. div_t  _CDECL div(int, int);
  117. char * _CDECL ecvt(double, int, int *, int *);
  118. void   _CDECL exit(int);
  119. void   _CDECL _exit(int);
  120. char * _CDECL fcvt(double, int, int *, int *);
  121. void   _CDECL free(void *);
  122. char * _CDECL gcvt(double, int, char *);
  123. char * _CDECL getenv(const char *);
  124. char * _CDECL itoa(int, char *, int);
  125. long   _CDECL labs(long);
  126. unsigned long _CDECL _lrotl(unsigned long, int);
  127. unsigned long _CDECL _lrotr(unsigned long, int);
  128. char * _CDECL ltoa(long, char *, int);
  129. void   _CDECL _makepath(char *, char *, char *, char *, char *);
  130. void * _CDECL malloc(size_t);
  131. onexit_t _CDECL onexit(onexit_t);
  132. void   _CDECL perror(const char *);
  133. int    _CDECL putenv(char *);
  134. void   _CDECL qsort(void *, size_t, size_t, int (_CDECL *)(const void *, const void *));
  135. unsigned int _CDECL _rotl(unsigned int, int);
  136. unsigned int _CDECL _rotr(unsigned int, int);
  137. int    _CDECL rand(void);
  138. void * _CDECL realloc(void *, size_t);
  139. void   _CDECL _searchenv(char *, char *, char *);
  140. void   _CDECL _splitpath(char *, char *, char *, char *, char *);
  141. void   _CDECL srand(unsigned int);
  142. long   _CDECL strtol(const char *, char * *, int);
  143. unsigned long _CDECL strtoul(const char *, char * *, int);
  144. void   _CDECL swab(char *, char *, int);
  145. int    _CDECL system(const char *);
  146. char * _CDECL ultoa(unsigned long, char *, int);
  147.  
  148. #ifndef tolower            /* tolower has been undefined - use function */
  149. int _CDECL tolower(int);
  150. #endif    /* tolower */
  151.  
  152. #ifndef toupper            /* toupper has been undefined - use function */
  153. int    _CDECL toupper(int);
  154. #endif    /* toupper */
  155.